Link to this headingGHASH
- Used for the tag in [GCM](/Crypto/Symmetric Encryption/Block Ciphers/GCM) algorithm
Link to this headingImplementation
= 16
=
"""Multiply two polynomials in GF(2^m)/g(w)
g(w) = w^128 + w^7 + w^2 + w + 1
(operands and result bits reflected)"""
=
=
= 0
#print(temp_key,y,z)
^=
<<= 1
= ^
>>= 1
return
=
=
=
return
#Get Byte length * 8
return
= b*16
#Pad additional_authenticated_data
= +
#Pad input data
= +
#For each block of padded additional_authenticated_data, xor and mult with the auth key
=
#For each block of Padded input_data xor and mult with the auth key
=
#Also xor and mult with the length of the data
= +
return
=
= b
=
#Reference from web.mit.edu/freebsd/head/contrib/wpa/src/crypto/aes-gcm.c